/**
 * @author Coande
 * 封装到对象，避免命名空间冲突
 */
Cookie = {
	//设置cookie
	setCookie: function setCookie(name, value) {
		/*指定cookie保存时间*/
		var Days = 30;
		var exp = new Date();
		exp.setTime(exp.getTime() + Days * 24 * 60 * 60 * 1000);
		document.cookie = name + "=" + escape(value) + ";expires=" + exp.toGMTString();
	},
	//根据key获取cookie值
	getCookie: function getCookie(name) {
		var arr = document.cookie.match(new RegExp("(^| )" + name + "=([^;]*)(;|$)"));
		if(arr != null) {
			return unescape(arr[2]);
		} else {
			return null;
		}
	},
	//根据key删除cookie
	delCookie: function delCookie(name) {
		var exp = new Date();
		exp.setTime(exp.getTime() - 1);
		var cval = getCookie(name);
		if(cval != null)
			document.cookie = name + "=" + cval + ";expires=" + exp.toGMTString();
	}
}